<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
$tabs=array(
	array('op'=>'basic','title'=>'基本参数设置'),
);
if($_RQ['op']=='basic'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('basic',$postdata);
		exi('设置成功');
	}
	$footernav =array(
		array('title'=>'首页','icon'=>'icon-shouye','action'=>'jy_gohome/index/'),
		array('title'=>'全部','icon'=>'icon-dianpu','action'=>'jy_gohome/all/'),
		array('title'=>'技师','icon'=>'icon-ship','action'=>'jy_gohome/allworker/'),
		array('title'=>'积分商城','icon'=>'icon-gifts','color'=>'#66cc99','action'=>'jy_creditshop/index/'),
		array('title'=>'我的','icon'=>'icon-wo1','action'=>'jy_gohome/home/'),
	);
	$tags='手法有力|手法柔和|疏通经络|微笑服务|贴心服务|积极乐观|提神醒脑|认真负责';
	$my_days = array(
			array('title'=>'我的预约','icon'=>'icon-form','color'=>'#cc99ff','action'=>'jy_gohome/order/'),
			array('title'=>'会员卡','icon'=>'icon-erweima','color'=>'#cc99ff','action'=>'core/member.card/'),
			array('title'=>'我的优惠券','icon'=>'icon-youhuiquan','color'=>'#cc99ff','action'=>'jy_weishop/coupon.myindex/'),
			array('title'=>'充值记录','icon'=>'icon-chongzhi','color'=>'#cc99ff','action'=>'core/member.log/'),
			array('title'=>'积分日志','icon'=>'icon-jifen','color'=>'#cc99ff','action'=>'core/member.credit_log/list/type=1'),
	);	
	$return['item']=$this->plugin_setting('basic');
	$return['item']['my_days'] = !empty($return['item']['my_days']) ? $return['item']['my_days'] : $my_days;
	$return['item']['demomy_days'] = $my_days;
	$return['item']['tags']=$return['item']['tags']?$return['item']['tags']:$tags;
	$return['item']['footernav']=$return['item']['footernav']?$return['item']['footernav']:$footernav;
	$fenxiaoset=array(
		array('type'=>'tip','title'=>'[温馨提示]：需要安装对应的分销插件，才显示开启！'),
	);
	if($this->plugin_exists('jy_area_agent')){
		$fenxiaoset[]=array('type'=>'switch','title'=>'是否启用区域代理？','name'=>'jy_area_agent','isradio'=>1);
	}
	if($this->plugin_exists('jy_teamfee')){
		$fenxiaoset[]=array('type'=>'switch','title'=>'是否启用团长极差分红？','name'=>'jy_teamfee','isradio'=>1);
	}
	if($this->plugin_exists('jy_commission')){
		$fenxiaoset[]=array('type'=>'switch','title'=>'是否启用微客分销？','name'=>'jy_commission','isradio'=>1);
	}
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'edit_tab'=>true,
		'edits'=>array(
			array(
				'title'=>'基本信息',
				'list'=>array(
					array('type'=>'string','title'=>'平台名称','name'=>'name','help'=>''),
					array('type'=>'string','title'=>'平台公告','name'=>'notice'),
					array('type'=>'string','title'=>'营业时间','name'=>'work_time'),
					array('type'=>'string','title'=>'平台电话','name'=>'phone'),
					array('type'=>'string','title'=>'平台地址','name'=>'address'),
					array('type'=>'text','title'=>'平台详情','name'=>'remark'),
					array('type'=>'string','title'=>'首页项目分类(每行显示个数)','name'=>'bankuainum','help'=>'默认显示4个一排！'),
					array('name'=>'tags','title'=>'标签集','type'=>'text','help'=>'每个标签用|隔开；'),
					array('name'=>'ruzhu','title'=>'是否开启服务人员入驻','type'=>'switch','help'=>'开启入驻则他人可自行注册申请成为服务人员'),
					array('name'=>'dingwei','title'=>'是否关闭自动定位','type'=>'switch','help'=>''),
					array('name'=>'recharge','title'=>'是否关闭会员充值','type'=>'switch','help'=>''),
				)
			),
			array(
					'title'=>'分销设置',
					'list'=>$fenxiaoset
			),
			array(
				'title'=>'幻灯片',
					'list'=>array(
						array(
							'type'=>'array',
							'name'=>'image',
							'add_tip'=>'添加一个幻灯片',
								'list'=>array(
									array('type'=>'image','name'=>'picurl','title'=>'幻灯片图片'),
									array('type'=>'string','name'=>'url','title'=>'幻灯片链接'),
									
								),
								'details'=>array(
									array('type'=>'image','name'=>'picurl','title'=>'幻灯片图片','help'=>''),
									array('type'=>'string','name'=>'url','title'=>'幻灯片链接'),
									
								)
						)
					)
			),
			array(
				'title'=>'底部导航',
					'list'=>array(
									array('type'=>'array','name'=>'footernav','add_tip'=>'添加一个底部导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标','help'=>'图标，例如：icon-shouye'),							
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
								),
					)
			),
			array(
				'title'=>'会员中心菜单',
					'list'=>array(
								array('type'=>'updemo','name'=>'my_days','demo'=>'demomy_days','title'=>'重置会员中心菜单','help'=>'不知道添加什么会员中心菜单？重置默认的一下试试！'),
									array('type'=>'array','name'=>'my_days','add_tip'=>'添加一个菜单',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'菜单名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'菜单图标'),
										array('type'=>'string','name'=>'action','title'=>'菜单链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'菜单名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'菜单图标','help'=>'图标，例如：icon-shouye'),							
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'菜单链接'),
									)
								),
					)
			),
		),
	);
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='message_tpl'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$data=array_fields(array('confirm','cancel','tuikuan','disagree','notice'),$postdata);
		$this->plugin_setting('message_tpl',$data);
		exi('设置成功');
	}
	$return['item']=$this->plugin_setting('message_tpl');
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'tabs'=>$tabs,
		'edit'=>array(
		array('type'=>'string','title'=>'有新订单通知消息模板','name'=>'notice','help'=>'该消息为客户下单后通知服务人员，公众号所在行业需要为’IT行业，‘请在微信公众平台搜索‘新预约提醒’模板，找到编号为‘OPENTM206749817’的模板，添加到你的模板库中，然后将对应的模板id复制到此项中'),
			array('type'=>'string','title'=>'预约已受理通知消息模版','name'=>'confirm','help'=>'该消息为确认订单后通知客户，公众号所在行业需要为’IT行业，请在微信公众平台搜索‘预约受理通知’模板，找到编号为‘OPENTM408199351’的模板，添加到你的模板库中，然后将对应的模板id复制到此项中'),
			//array('type'=>'string','title'=>'预约被取消通知消息模版','name'=>'cancel'),
			//array('type'=>'string','title'=>'退款成功通知消息模版','name'=>'tuikuan'),
			//array('type'=>'string','title'=>'退款被拒绝通知消息模版','name'=>'disagree'),
		),
	);
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='sms_tpl'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$data=array_fields(array('notice'),$postdata);
		$this->plugin_setting('sms_tpl',$data);
		exi('设置成功');
	}
	$return['item']=$this->plugin_setting('sms_tpl');
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'tabs'=>$tabs,
		'edit'=>array(
			array('type'=>'string','title'=>'新订单通知模版','name'=>'notice'),
		),
	);
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='diy'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$data=array_fields(array('store','serve','worker','home','all'),$postdata);
		$this->plugin_setting('diy',$data);
		exi('设置成功');
	}
	$return['item']=$this->plugin_setting('diy');
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'tabs'=>$tabs,
		'edit'=>array(
			array('type'=>'string','title'=>'首页','name'=>'index','help'=>'填写则底部菜单"首页"将替换为填写的内容，不填则为默认的菜单'),
			array('type'=>'string','title'=>'全部','name'=>'all','help'=>'填写则底部菜单"首页"将替换为填写的内容，不填则为默认的菜单'),
			array('type'=>'string','title'=>'项目','name'=>'serve','help'=>'填写则底部菜单"项目"将替换为填写的内容，不填则为默认的菜单'),
			array('type'=>'string','title'=>'技师','name'=>'worker','help'=>'填写则菜单"技师"将替换为填写的内容，不填则为默认的菜单'),
			array('type'=>'string','title'=>'我的','name'=>'home','help'=>'填写则菜单"我的"将替换为填写的内容，不填则为默认的菜单'),
		),
	);
	$return['htmls']=$htmls;
	exi($return);
}

